<template>
	<view class="main">
		<!-- 房屋信息 -->
		<view class="xinxi">{{name}}</view>
		<view class="xiaoquda">
			<!-- 小区 -->
			<view class="uni-list-cell" v-for="(item,index) in data" :key="index" @click="changebuilding(item.houseno)">
				<view class="uni-list-cell-left">{{item.houseno}}</view>
				<view class="uni-list-cell-db">
					<view class="">
						<image class="you-img" src="../../static/images/index/右.png" mode=""></image>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import Index from '../../apis/index.js'
	import {mapState} from 'vuex'
	export default{
		data(){
			return {
				index:'',
				mindex:'',
				name:'',
				data:[]
			}
		},
		onLoad(options){
			this.index = options.index
			let arr = this.index.split(',')
			let buildid = this.buildingdata[arr[0]].children[arr[1]].children[arr[2]].id
			console.log(buildid);
			this.getroom(buildid)
		},
		methods:{
			async getroom(buildid){
				let res = await Index.userhouseslist({buildingid:buildid})
				console.log(res);
				if(res.errCode==10000){
					this.name = res.data.list[0].building
					this.data = res.data.list
				}
			},
			changebuilding(roomname){
				console.log('没有页面了');
				uni.navigateBack({
					delta:3
				})
			},
			bindPickerChange(e){
				this.index = e.detail.value
			},
			
		},
		computed:{
			...mapState(['buildingdata'])
		}
	}
</script>


<style lang="less">
	@import url('../../static/css/housePage/housepage3/housepage.css');
</style>